package com.example.demo.web;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping("/demo")
@Slf4j
public class DemoController {

    @Value("${sys.name}")
    private String sysStr;

    @RequestMapping("/test")
    public String getMsg() {
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String timeStr = now.format(formatter);

        log.info("timeStr={}", timeStr);
        return "Welcome, the current time is " + timeStr + "env=" + sysStr;
    }
}